package com.hzdesk.media.koreabatchmatvector.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hzdesk.media.koreabatchmatvector.R;
import com.hzdesk.media.koreabatchmatvector.bean.WiredNetworkSettingsBean;

import java.util.List;

/**
 * Created by Administrator on 2018/8/3.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 */

public class WiredNetworkSettingsAdapter extends RecyclerView.Adapter<WiredNetworkSettingsAdapter.ViewHolder> {

    private List<WiredNetworkSettingsBean> mlist ;
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_wired_network_settings,parent,false);
       ViewHolder mViewHolder = new ViewHolder(view);
        return mViewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.tv_title.setText(mlist.get(position).getName());
        holder.tv_desc.setText(mlist.get(position).getConfig());
    }

    @Override
    public int getItemCount() {
        return mlist==null?0:3;
    }
    public void  addItem(List<WiredNetworkSettingsBean> mbean){
        mlist = mbean;
        notifyDataSetChanged();
    }

    class ViewHolder extends RecyclerView.ViewHolder {

        private final TextView tv_title;
        private final TextView tv_desc;

        public ViewHolder(View itemView) {
            super(itemView);
            tv_title = itemView.findViewById(R.id.item_wired_network_settings_tv_title);
            tv_desc = itemView.findViewById(R.id.item_wired_network_settings_tv_desc);
        }
    }
}
